from pydantic import BaseModel, Field

from app.models import StatusType


class BaseDept(BaseModel):
    """
    部门
    """
    name: str = Field(..., description="部门名称", examples=["研发中心"])
    desc: str = Field("", description="备注", examples=["研发中心"])
    order: int = Field(0, description="排序")
    parent_id: int = Field(0, description="父部门ID")
    status: int = Field(StatusType.ENABLED, description="状态")


class DeptCreate(BaseDept):
    """
    创建部门
    """
    code: str = Field(..., description="部门编码", examples=["it"])


class DeptUpdate(BaseDept):
    """
    修改部门
    """
    id: int
